package com.livesource.client;

import com.google.gwt.user.client.ui.VerticalPanel;
import com.livesource.client.web.sourceCode.SourceCodePage;
import com.livesource.client.web.sourceCode.filesTree.FilesTree;
import com.livesource.client.web.sourceCode.filesTree.FilesViewList;
import com.livesource.client.webservices.project.RequestGetProject;

public class InitializeLiveSource {

	public static VerticalPanel vpLiveSource = new VerticalPanel();

	public static VerticalPanel getPanel(String userID, String projectSelectedID) {

		LiveSourceGlobalVariables.currentUserID = userID;

		vpLiveSource.clear();

		vpLiveSource.add(new SourceCodePage(FilesViewList.VIEW_CLASS_FILES));

		if (LiveSourceGlobalVariables.currentProject == null
				|| !projectSelectedID
						.equals(LiveSourceGlobalVariables.currentProject
								.getProjectID())) {

			LiveSourceGlobalVariables.projectEntries = null;

			RequestGetProject.getJsonpRequest(projectSelectedID);

		} else {

			loadPanel();
		}

		return vpLiveSource;
	}

	public static void loadPanel() {

		FilesTree tree = new FilesTree(FilesViewList.VIEW_CLASS_FILES,
				LiveSourceGlobalVariables.projectEntries);

		SourceCodePage.featuresTreePanel.clear();
		SourceCodePage.featuresTreePanel.add(tree);
	}

	/*
	 * if (MENU_DOCUMENTATION.equals(panelSelected)) {
	 * 
	 * DocumentationPage.untoggleLinks(); DocumentationPage.featuresListLink
	 * .setHTML(FeaturesListLink.textPressed);
	 * 
	 * DocumentationPage.documentationVisualizationPanel.clear();
	 * DocumentationPage.documentationVisualizationPanel .add(new
	 * ListTaggedClasses(ProjectFeature.FEATURE_TYPE));
	 * 
	 * } else if (MENU_LIVE_TASK_BOARD.equals(panelSelected)) {
	 * 
	 * BoardPanel.showTasks(LiveSourceGlobalVariables.projectEntries);
	 */

}
